package cn.iocoder.yudao.module.squaredancing.dal.mysql.advertisement;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.squaredancing.dal.dataobject.advertisement.AdvertisementDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.squaredancing.controller.admin.advertisement.vo.*;

/**
 * 广告数据 Mapper
 *
 * @author 赵云安
 */
@Mapper
public interface AdvertisementMapper extends BaseMapperX<AdvertisementDO> {

    default PageResult<AdvertisementDO> selectPage(AdvertisementPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AdvertisementDO>()
                .eqIfPresent(AdvertisementDO::getTitle, reqVO.getTitle())
                .eqIfPresent(AdvertisementDO::getSummary, reqVO.getSummary())
                .eqIfPresent(AdvertisementDO::getImageUrl, reqVO.getImageUrl())
                .betweenIfPresent(AdvertisementDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AdvertisementDO::getId));
    }

}